<?php

class User{
    
    function __construct(){
        $this->db = new Database(DB_TYPE, DB_HOST, DB_NAME, DB_USER, DB_PASS);
    }
    
   public function login($email, $pass){
        $sth = $this->db->prepare('SELECT * FROM Users WHERE email = :email AND password = :pass');
        $sth->bindValue(':email', $email);
        $sth->bindValue(':pass', $pass);
        $sth->execute();
        return $sth->fetch();
    }
    
    public function createSession($name, $email){
        Session::start();
        Session::set('user', $name);
        Session::set('email', $email);
        header('Location: index2.php');
    }
}
?>
